<template>
<div class="bottom_div flex_ac flex_sb">
  <div class="b_item" @click="changeCollect">
    <img src="~@/assets/img/collect.png" alt="">
    收藏
  </div>
  <div class="b_item">
    <img src="~@/assets/img/share.png" alt="">
    分享
  </div>
  <div class="b_item">
    <img src="~@/assets/img/company/report.png" alt="">
    尽调报告
  </div>
  <div class="b_item">
    <img src="~@/assets/img/company/pdf.png" alt="">
    企业报告
  </div>
  <div class="btn mla">
    联系我们
  </div>
</div>
</template>
<script>
import { collect } from '@/api/api'
export default {
  props: {
    data: {
      default:{}
    },
    type: {
      default:1
    },
  },
  data() {
    return {
      is_collect:false
    }
  },
  watch: {
    // 'data': function () {
    //   collect.check({ type: this.type, identification: this.data.identification || this.data.id }).then(res => {
    //     if (res.data.is_collect) {
    //       this.is_collect = true
    //     }
    //   })
    // }
  },
  methods: {
    toBm() {
      this.$router.push({name:'huiyiBm',query:{id:this.id}})
    },
    changeCollect() {
      let data = {
        type: this.type,
        identification: this.data.identification || this.data.id,
        name: this.data.name || this.data.title || this.data.company_name || this.data.park_name || this.chain_name || this.policy_name,
        status: this.is_collect == true?2:1
      }
      collect.action({ ...data }).then(res => {
        if(res.status==1){
          this.is_collect = !this.is_collect
          this.$toast(this.is_collect?'已关注':'取消关注')
        } else {
          this.$toast('操作失败')
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.bottom_div{
  position: fixed;
  bottom: 0px;
  width: calc(100% - 20px);
  height: 60px;
  left: 0;
  background: #fff;
  padding: 0 10px;
  box-shadow: 0 0 10px 0 rgba(0,0,0,0.1);
  .b_item{
    text-align: center;
    width: 16%;
    font-size: 12px;
    color: #333333;
    img{
      width: 22px;
      height: 22px;
      display: block;
      margin:auto;
      margin-bottom: 3px;
    }
  }
  .btn{
    width: 110px;
    height: 35px;
    background: linear-gradient(to right, #FFBA7C 0%, #FA8A26 100%);
    box-shadow: 0px 1px 2px 0px rgba(203,204,213,0.69);
    border-radius: 18px;
    text-align: center;
    line-height: 35px;
    font-size: 18px;
    color: #FFFFFF;
  }
}
</style>
